/**
 * Copyright (c) 2012 Nokia Corporation.
 */

package com.nokia.example.simplepurchase;

import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

/**
 * The application main class. 
 */
public class Main extends MIDlet {

	private Display display;
	
	public Main() {
		this.display = Display.getDisplay(this);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.microedition.midlet.MIDlet#startApp()
	 */
	protected void startApp() throws MIDletStateChangeException {
		Displayable main = new IapCanvas(this);
		this.display.setCurrent(main);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.microedition.midlet.MIDlet#destroyApp(boolean)
	 */
	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {}

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.microedition.midlet.MIDlet#pauseApp()
	 */
	protected void pauseApp() {}
	
	/**
	 * Exits the application.
	 */
	public void exit() {
		notifyDestroyed();
	}
}
